<template>
  <!--    面包屑-->
  <el-breadcrumb separator-class="el-icon-arrow-right">
    <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item>权限管理</el-breadcrumb-item>
    <el-breadcrumb-item>权限列表</el-breadcrumb-item>
  </el-breadcrumb>
  <!--    卡片区域-->
  <el-card class="box-card">
    <!--      表格,border加边框，stripe加隔行变色,:data="userList"数据在这里-->
    <el-table
      border
      stripe
      :data="rightsList"
      style="width: 100%"
      max-height="650"
    >
      <el-table-column
        prop="id"
        label="#">
      </el-table-column>
      <el-table-column
          prop="authName"
        label="权限名称">
      </el-table-column>
      <el-table-column
        prop="path"
        label="路径">
      </el-table-column>
      <el-table-column
        prop="level"
        label="权限等级">
          <template v-slot="slotItem">
            <el-tag v-if="slotItem.row.level==0">等级一</el-tag>
            <el-tag v-else-if="slotItem.row.level==1" type="success">等级二</el-tag>
            <el-tag v-else type="warning">等级三</el-tag>
          </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script>
import {ElMessage} from "element-plus";

export default {
name: "rights",
  data(){
    return{
      rightsList:[]
    }
  },
  created() {
  this.getAllRights();
  },
  methods:{
    getAllRights(){
      this.axios.get('rights/list').then(resp=>{
        if(resp.data.meta.status!==200) return;
        this.rightsList=resp.data.data;
        console.log(this.rightsList.id);
      }).catch(err=>{
        console.log(err);
      })
    }
  }
}
</script>

<style scoped>
  .el-breadcrumb{
    font-size: 20px;
  }
  .box-card{
    margin-top: 20px;
  }
  .el-pagination{
    margin-top: 20px;
  }
</style>
